from django.http import HttpResponse, Http404
import datetime

def hello(request):
    return HttpResponse("Hello world")

def current_time(request):
    now = datetime.datetime.now()
    html = "<html><body>It is now %s</body></html>" %now
    return HttpResponse(html)

def hours_head(request, offset):
    try:
        offset = int(offset)
    except ValueError:
        raise Http404()
    dt = datetime.datetime.now() + datetime.timedelta(hours=offset)
#     assert False
    html = "<html><body>In %s hours late, the time is %s</body></html>" %(offset, dt)
    return HttpResponse(html)
        
        
        